/*
 * @Author: dingxiao
 * @Date: 2025-06-18 16:28:24
 * @Description: 调研工作计划服务层
 */
import { groupBy } from 'lodash-es';
import { mainSend } from '@/api/utils/constants';
import ResearchWorkPlanParam from './entities/ResearchWorkPlanParam';
import ResearchWorkPlanResult from './entities/ResearchWorkPlanResult';
import CommonService from '../common/CommonService';

/**
 * service
 */
class ResearchWorkPlanService extends CommonService {
  /**
   * 获取表单信息，并且格式化表单内容
   * @param {String} piid 流程实例id
   */
  getFormInfo = async (piid, obj) => {
    const data = await this.getFormCommonInfo(piid);
    const result = new ResearchWorkPlanResult(data, obj);
    return result.getData();
  }

  /**
   * 保存表单信息
   * @param {Object} data 表单数据
   * @param {Array} files 附件列表
   * @param {Boolean} isSaveFile 是否保存文件
   */
  saveFormInfo = async (data, files = [], isSaveFile = true) => {
    const param = new ResearchWorkPlanParam(data, files, isSaveFile);
    const { data: { data: id } } = await this.saveFormCommonInfo(param.setData());
    return id;
  }
}
export default ResearchWorkPlanService;
